<template>
    <h3>添加投资表</h3>
    <table border="1">
        <tr>
            <td>投资名称</td>
            <td>
                <input type="text" v-model="info.FName" placeholder="请输入投资名称">
            </td>
        </tr>
        <tr>
            <td>投资总额度</td>
            <td>
                <input type="text" v-model="info.FSumPrice" placeholder="请输入投资总额度">
            </td>
        </tr>
        <tr>
            <td>已投资额度</td>
            <td>
                <input type="text" v-model="info.FPriced" placeholder="请输入已投资额度">
            </td>
        </tr>
        <tr>
            <td>剩余额度</td>
            <td>
                <input type="text" v-model="info.FPricest" placeholder="请输入剩余额度">
            </td>
        </tr>
        <tr>
            <td>投资人数</td>
            <td>
                <input type="text" v-model="info.FNumber" placeholder="请输入投资人数">
            </td>
        </tr>
        <tr>
            <td colspan="2">
               <input type="button" value="添加" @click="AddFinan">
            </td>
        </tr>
    </table>
</template>


<script setup lang="ts">
import{ref}from 'vue'
import axios from 'axios';

const info=ref({
    FName:'',
    FSumPrice:'',
    FPriced:0,
    FPricest:'',
    FNumber:0
})

const AddFinan=()=>{
    axios.post("http://localhost:3947/api/API/Add",{
        
        FName:info.value.FName,
        FSumPrice:info.value.FSumPrice,
        FPriced:info.value.FPriced,
        FPricest:info.value.FPricest,
        FNumber:info.value.FNumber
    })
    .then(res=>{
        if(res.data>0){
            alert("添加成功")
            location.href="/ShowFinan"
        }
        else{
            alert("添加失败")
        }
    })
}

</script>